package com.acme.bankapp.domain.bank;

import com.acme.bankapp.exceptions.bank.NotEnoughFundsException;

public class SavingsAccount extends AbstractAccount{
	
	public SavingsAccount(int initialValue) throws IllegalArgumentException{
		super(initialValue);
	}
	
	public void withdraw(int sum) throws NotEnoughFundsException{
		if(this.getBalance() >= sum){
			this.setBalance(this.getBalance() - sum);
		}
		else{
			throw new NotEnoughFundsException(this);
		}
	}
	
	public int maximumAmountToWithdraw(){
		return this.getBalance();
	}
}
